home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1987-03-15 | 3.2 KB | 109 lines |
- 100 REM CREATMAR Program
- 110 REM Creates (Formats) a Marriages File
- 120 REM Copyright (c) 1983 - 1987 by: Melvin O. Duke.
- 130 DEFINT A-Z
- 600 REM Titles
- 610 TITLE$ = "Create a Marriages File"
- 620 TITLE$ = TITLE$ + " ON DISPLAY"
- 700 REM Terminate if not called from the Menu
- 710 IF DD.MENU$ <> "" THEN 770
- 720 COLOR 7,0 : KEY ON : CLS : LOCATE 15,1
- 730 PRINT "Cannot run the"
- 740 PRINT TITLE$
- 750 PRINT "Program, unless selected from the MENU"
- 760 END
- 770 REM OK
- 1000 REM Produce the first screen
- 1010 KEY ON : CLS : KEY OFF
- 1020 REM Draw the outer double box
- 1030 R1 = 1 : C1 = 1 : R2 = 24 : C2 = 79 : GOSUB 1300
- 1040 REM Find the title location
- 1050 TITLE.POS = 40 - INT(LEN(TITLE$)/2)
- 1060 REM Draw the title box
- 1070 R1=3:C1=TITLE.POS-2:R2=6:C2=TITLE.POS+LEN(TITLE$)+1:GOSUB 1500
- 1080 REM Print the title
- 1090 LOCATE 4,TITLE.POS : PRINT TITLE$
- 1100 LOCATE 5,40-INT(LEN(VERSION$)/2) : PRINT VERSION$;
- 1230 REM Draw the Copyright box
- 1240 R1 = 19 : C1 = 21 : R2 = 22 : C2 = 59 : GOSUB 1300
- 1250 REM Print the Copyright
- 1260 LOCATE 20,40-INT(LEN(COPY1$)/2) : PRINT COPY1$;
- 1270 LOCATE 21,40-INT(LEN(COPY2$)/2) : PRINT COPY2$;
- 1280 GOTO 1700
- 1300 REM subroutine to print a double box
- 1310 COLOR P
- 1320 FOR I = R1 + 1 TO R2 - 1
- 1330 LOCATE I, C1 : PRINT CHR$(186);
- 1340 LOCATE I, C2 : PRINT CHR$(186);
- 1350 NEXT I
- 1360 LOCATE R1, C1+1 : PRINT STRING$(C2-C1-1,205);
- 1390 LOCATE R2, C1+1 : PRINT STRING$(C2-C1-1,205);
- 1400 LOCATE R1, C1 : PRINT CHR$(201);
- 1410 LOCATE R1, C2 : PRINT CHR$(187);
- 1420 LOCATE R2, C1 : PRINT CHR$(200);
- 1430 LOCATE R2, C2 : PRINT CHR$(188);
- 1440 COLOR W
- 1450 RETURN
- 1500 REM subroutine to print a single box
- 1510 COLOR B
- 1520 FOR I = R1 + 1 TO R2 - 1
- 1530 LOCATE I, C1 : PRINT CHR$(179);
- 1540 LOCATE I, C2 : PRINT CHR$(179);
- 1550 NEXT I
- 1560 LOCATE R1, C1+1 : PRINT STRING$(C2-C1-1,196);
- 1590 LOCATE R2, C1+1 : PRINT STRING$(C2-C1-1,196);
- 1600 LOCATE R1, C1 : PRINT CHR$(218);
- 1610 LOCATE R1, C2 : PRINT CHR$(191);
- 1620 LOCATE R2, C1 : PRINT CHR$(192);
- 1630 LOCATE R2, C2 : PRINT CHR$(217);
- 1640 COLOR W
- 1650 RETURN
- 1700 REM ask user to press a key to continue
- 1710 LOCATE 25,1
- 1720 PRINT "Have Data Diskette(s) in Place, then Press any key to continue.";
- 1730 K$ = INKEY$ : IF K$ = "" THEN 1730
- 1740 KEY ON : CLS : KEY OFF
- 1800 REM Give the User one more chance to protect himself.
- 1810 LOCATE 10,1
- 1820 PRINT "This program FORMATS a Marriages-file by writing new, empty records."
- 1830 PRINT "It will destroy any data which exists with the same record-numbers."
- 1840 PRINT
- 1850 PRINT "If this is REALLY what you want to do,"
- 1860 PRINT "type y to continue, and press the 'enter' key."
- 1870 PRINT "Otherwise, type anything else, and press the 'enter' key."
- 1880 PRINT
- 1890 LINE INPUT "Enter your desired action: ",REPLY$
- 1900 IF LEFT$(REPLY$,1) = "y" THEN 2000
- 1910 IF LEFT$(REPLY$,1) = "Y" THEN 2000
- 1920 PRINT
- 1930 PRINT "File was NOT Created."
- 1940 PRINT
- 1950 PRINT "Press any key to continue"
- 1960 A$ = INKEY$ : IF A$ = "" THEN 1960
- 1970 GOTO 2220 'to end the program
- 2000 REM CREATMAR Program Starts Here
- 2010 OPEN DD.MARR$+"marrfile" AS #2 LEN = 128
- 2020 FIELD 2, 5 AS M1$, 5 AS M2$, 5 AS M3$, 5 AS M4$, 11 AS M5$, 18 AS M6$, 16 AS M7$, 16 AS M8$, 45 AS M9$
- 2030 '
- 2040 REM Write the Marriage Records
- 2050 FOR I = OLD.MAX.MAR + 1 TO MAX.MAR
- 2060 LOCATE 22,1 : PRINT "Writing Record:"; I
- 2070 TEMP! = -I
- 2080 LSET M1$ = MKS$(TEMP!) 'Record Number
- 2090 TEMP! = 0
- 2100 LSET M2$ = MKS$(TEMP!) 'Husband
- 2110 LSET M3$ = MKS$(TEMP!) 'Wife
- 2120 LSET M4$ = MKS$(TEMP!) 'Code
- 2130 TEMP$ = " "
- 2140 LSET M5$ = TEMP$ 'Marriage Date
- 2150 LSET M6$ = TEMP$ 'Marriage City
- 2160 LSET M7$ = TEMP$ 'Marriage County
- 2170 LSET M8$ = TEMP$ 'Marriage State
- 2180 LSET M9$ = TEMP$ 'Comments
- 2190 PUT #2, I
- 2200 NEXT I
- 2210 CLOSE #2
- 2220 KEY ON : CLS : KEY OFF : LOCATE 21,1
- 2230 PRINT "End of Program"
- 2240 RUN DD.MENU$+"menu"
-